package socket3;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerDemo {
	public static void main(String[] args) {
		try {
			ServerSocket server=new ServerSocket(8899);
			System.out.println("服务器已启动");
			System.out.println(server.getLocalPort());
			Socket socket=server.accept();
			System.out.println(socket.getPort());
			System.out.println("客户端连接");
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}

}
